#include <iostream>
using namespace std;
int main() {
	int n = 7, a[n] = {7, 8, 5, 2, 4, 1, 3}, r = 0, s = 1;
	while (r < n - 1) {
		while (a[s] < a[s - 1] and s > 0) {
			int i = a[s];
			a[s] = a[s - 1];
			a[s - 1] = i;
			s--;
		}
		r++;
		s = r + 1;
	}
	for (int i = 0; i < n; i++) {
		cout << a[i] << " ";
	}
	return 0;
}
